# -*- coding: utf-8 -*-
# @Time : 2023/7/30 22:21
# @Author : zxp
from rest_framework import permissions


class IsSelfOrReadOnly(permissions.BasePermission):
    def has_object_permission(self, request, view, obj):
        if request.method in permissions.SAFE_METHODS:
            return True
        return obj == request.user
